package com.jlboot.config;

import cn.dev33.satoken.stp.StpInterface;
import com.jlboot.model.po.sys.SysRole;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author wangsanfei
 * @version 1.0
 * Create by 2024/1/1 22:38
 */
@Slf4j
public class StpInterfaceImpl implements StpInterface {
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        log.info("satoken-loginId-getPermissionList:{},loginType:{}",loginId,loginType);
        return new ArrayList<>();
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        log.info("satoken-loginId-getRoleList:{},loginType:{}",loginId,loginType);
        List<SysRole> sysRoleList=SysRole.dao.getUserRoleList(loginId);
        return sysRoleList.stream().map(t->t.getStr("code")).collect(Collectors.toList());
    }
}
